/*
 * > /*
>  * INSANE - Interactive Structural Analysis Environment
>  *
>  * Copyright (C) 2003-2004
>  * Universidade Federal de Minas Gerais
>  * Escola de Engenharia
>  * Departamento de Engenharia de Estruturas
>  *
>  * Author's email :     insane@dees.ufmg.br
>  * Author's Website :   http://www.dees.ufmg.br/insane
>  *
>  * This program is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU General Public License
>  * as published by the Free Software Foundation; either version 2
>  * of the License, or any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program; if not, write to the Free Software
>  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-
> 1307, USA.
 *
 */

package br.ufmg.dees.insane.commons.view;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;


/**
 * The class represents a StepList, that is composed of many steps
 * @author Samuel Silva Penna
 * @since 13/06/2006
 */
public class ModelList implements Serializable{

	/**   */
	private static final long serialVersionUID = 1L;
	/** The label of this list */
	private String label;
	/** The list of steps */
	private HashMap<String, Object> modelList;
	
	private ArrayList<String> keys;
	
	/** 
	 * The Default constructor 
	 */
	public ModelList(){
		this.modelList = new HashMap<String, Object>();
		this.keys = new ArrayList<String>();
	}
	
	/**
	 * The method return the label.
	 * @return Returns The label.
	 */
	public String getLabel() {
		return this.label;
	}

	/**
	 * The method set the field Label from the parameter label.
	 * @param label The label to set.
	 */
	public void setLabel(String label) {
		this.label = label;
	}

	/** 
	 * The method put a value with respective key, in values HashMap.
	 * @param key The key of the value.
	 * @param value The respective value.
	 */
	public void putModel(String key, Object obj){
		this.modelList.put(key,obj);
		this.keys.add(key);
	}
	
	/** 
	 * The method put a value with respective key, in values HashMap.
	 * @param key The key of the value.
	 * @param value The respective value.
	 */
	public void removeModel(String key){
		this.modelList.remove(key);
		this.keys.remove(key);
	}
	
	/**
	 * The method return a value relative to the passed key
	 * @param key The key of the value that will be the return. 
	 * @return The respective value of the Key.
	 */
	public Object getModel(String key){
		return this.modelList.get(key);
	}
	
	/**
	 * The method set the field keys from the parameter keys.
	 * @param keys The keys to set.
	 */
	public ArrayList getKeys() {
		return this.keys;
	}
	
	/**
	 * The method set the field keys from the parameter keys.
	 * @param keys The keys to set.
	 */
	public void setKeys(ArrayList<String> keys) {
		this.keys = keys;
	}
	
	/**
	 * The method return the modelList.
	 * @return Returns The modelList.
	 */
	public HashMap getModelList() {
		return modelList;
	}

	/**
	 * The method set the field modelList from the parameter modelList.
	 * @param modelList The modelList to set.
	 */
	public void setModelList(HashMap<String, Object> modelList) {
		this.modelList = modelList;
		for(int i=0;i<modelList.keySet().size();i++){
			this.keys.add((String)modelList.keySet().toArray()[i]);
		}
	}
	
//******************************************************************************************
}//end of this class
